replaced Serializable with Object
additional exceptions thrown instead of NPEs with tests