Error handling + fixes