Fixes #289

Credit goes to @pandamouse