applied fixes for issue 45