fixed several bugs in original build