fixed issues 48, 42, 39, 49