better error handling, fix shl