Cherry picked some bug fixes and video frame from w_maze branch