Fixed some bugs, preparation for surroagate methods