fixed NPEs and cleaned up execute.