Fixed some bugs

Procedure's is a little wrong