Removed int to enum cast which throws exception