Fixes to kernel launch and allocation macro to stop it giving the wrong results