bug fixes

Fixed some bugs, still need to work on tiling