Attempt to fix enum cast error