Cast error fixed