Fix procedures and test