fixed some bugs I made yesterday when I merged code