Removed casts by using default methods.
Fix bug.