Fixed bug submitted by tjrocha on GitHub