fix by @derekhinchliffe