Fixed classcast exceptions