Fixed crash, also added a default case to remove a warning