better error handling, using mixin for common error module, misc bugs squashed