bug fixes
Revert 0fe4de3..65bf79d

This rolls back to commit 0fe4de3e977848789495a5a4c89df5710af6f728.
segment fault 11 fix