Fixed #298 with Azanor's method as referenced by #299