fixs some bugs in sprite drawing