fixing procedures return bugs