Fixes #981. Sample breaking mod at http://hastebin.com/umitagulas.java.