Fixed mistakes in error handling and calling snockets