Address issue 114

At least a partial fix for issue 114. Not fully sure yet if other things need to be fixed as well.