$node is not present in the paglayout on cached pages. In paglayout use $module_result.node_id, but be aware that this variable is not present system pages (user/ and so on).
Take a look at this page: http://ez.no/doc/ez_publish/technical_manual/3_8/templates/the_pagelayout/variables_in_pagelayout