fix type issue on 0.3, fix exception handling