Fix wrong sign on pixel_y implementation.
Fix bad direction handling, clean up warnings.