prototype v1.2 but contains some error
fixed bugs