Implemented q_param and q_call, added some protection againts NULL calls in optimize