fix bugs in pyphase..