Finally fix the unchecked cast warning (see http://stackoverflow.com/questions/16689810/casting-a-generic-superclass-to-a-subclass)