Moved error and small fixes