Fix casting error