fix resize problem in chrome and better api