fixes #1272

Thanks to @ghostrigger