fix object types
add some exception handling