ported fixes made on devmaster-01