Fix #315 by @pacmanis

Credits go to @pacmanis