Fix a bug for ticket #5282
Merge pull request #302 from LGarciaSpherexx/bugfix

Fixes #5282 
Thanks for the pull request! could you please let me know, in case you have not tested this change?