Added a fix for crashes when the png dimensions were not divisible by 4.