fixed sprite code bugs