fixed Makefile, added condition functions except for wait