Issues #168, #176

Fixing some issues