Potential fix for issue #112

A bit hacky but seems to do the job I need it to