Some improvements and error-fixes