auto class casting doesnot always happen