various bug fixes thanks @86chenjie and @danslimmon