Fixed IndexOutOfBoundsException
Fixed crash on scaling window to zero height
Merge pull request #2 from WebFreak001/master

More fixes