Fix error handlings for get and refactor