fixed serious bugs in my method (common case)