null exception when no entity returned fixed